{%extends "base.html"%}
{%block body%}
{% if category %}
<h2>{{ category|capfirst }} Problems</h2>
{% else %}
<h2>All Problems</h2>
{% endif %}
<table class="problems" cellspacing="0" width="900">
  <tr style="color:#00ce1d;font-weight:bold;text-align:center">
    <td>Name</td><td>Categories</td><td>Contributed by</td>
    {% if user %}<td>Solved</td><td>Edit</td>{% endif %}
  </tr>
  
{% for problem in problems %}
  <tr>
    <td>
      <a href="{% url pywhip.views.code problem.problem.key.id %}">{{ problem.problem.name|escape }}</a>
    </td>
    <td>
        {% for c in problem.problem.categories %}
        {{ c }}
        {% endfor %}
    </td>
    <td>
      {{ problem.username }}
    </td>
    {% if user %}
    <td align="center">
      {% if problem.solved %}<img src="/static/solved.png" />{% endif %}
    </td>
    <td align="center"><a href="{% url pywhip.views.new_edit problem.problem.key.id %}">edit</a></td>
    {% endif %}

  </tr>
{% endfor %}

</table>

<p>
{% if user %}<a href="{% url pywhip.views.new_edit %}">Create new problem</a>{% endif %}
</p>

{%endblock%}
